# Dockerfile

FROM tiangolo/uvicorn-gunicorn-fastapi:latest

RUN apt-get update && apt-get install -y vim

WORKDIR /app

COPY requirements.txt /app
COPY app.py /app
COPY apis_module /app/apis_module
COPY config /app/config
COPY logs /app/logs
COPY utils /app/utils

RUN pip install --upgrade pip -i http://mirrors.cloud.tencent.com/pypi/simple --trusted-host mirrors.cloud.tencent.com
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt -i http://mirrors.cloud.tencent.com/pypi/simple --trusted-host mirrors.cloud.tencent.com

EXPOSE 9500

# 定义环境变量 不生成.pyc和__pycache__
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# 运行FastAPI应用
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "9500"]